Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
How to Redirect back to my website after transaction ends on Razorpay . Note: if "redirect=true" is passed as an option

Firstly I am using React and NodeJs for this integration.

I know it's possible to redirect back to the website by using location.href in the handler function.

But what if we are using redirect=true as an options.

It's also mentioned that we can pass the callback_url to the options object. This will make razorpay to redirect to this URL after a successful transaction but this is going to be a POST request. So, we cannot give the URL of our website in here.

example:

const options = {
  key: "razorpay_key",
  currency: data.currency,
  amount: data.amount.toString(),
  order_id: data.id,
  handler: function (response) {
    alert(response.razorpay_payment_id);
    alert(response.razorpay_order_id);
    alert(response.razorpay_signature);
  },
  prefill: {
    name,
    email: "abcd@xyz.com",
    contact: "9999999999",
    method: "netbanking",
  },
  redirect: true, // this redirects to the bank page from my website without opening a new window
  callback_url: "not sure what to do with it",
};

Is there any way I can get back to the cart/website page with these parameters in params (razorpay_payment_id, razorpay_order_id, razorpay_signature) after completion of the transaction.

here you can check all the parameters for checkout options: https://razorpay.com/docs/payments/server-integration/nodejs/payment-gateway/build-integration/#checkout-options

Razorpay web checkout docs link: https://razorpay.com/docs/payments/payment-gateway/web-integration/standard/

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You should have another db which stores all the value for your order.

So, Your callback_url will be -

Api to the database + unique order_id to provide you with details of order.

var options = {
  ... // existing options
  callback_url: 'https://localhost:3000/cart'+order_id,
  redirect: true
}
about 4 years ago · Santiago Trujillo Relatório

0

Eventually, I found a way to do the same. As I am using SSR, I created a POST route on my server and simply redirected from there to my webpage.

like,

app.post('/verification', asyncHandler((req, res) => {res.redirect(301, `webpage_url?query_param=${req.body.razorpay_payment_id}`}))

so, checkout options object looks like below

const options = {
    ... // existing options
    redirect: true,
    callback_url: "server_address/verification",
};

Hope it helps someone out facing the same issue :)

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda